﻿using System.IO;

namespace Z.IconLibraryGenerator.WinForm
{
    public partial class IconLibraryGeneratorManager
    {
        /// <summary>Copies the icon described by project.</summary>
        /// <param name="project">The project.</param>
        public static void CopyIcon(ProjectConfiguration project)
        {
            foreach (ProjectIcon icon in project.Icons)
            {
                string dirOutput = Path.Combine(project.OutputDirectory, project.ProjectName, icon.Prefix);

                Directory.CreateDirectory(dirOutput);
                foreach (FileInfo file in icon.Path.ToDirectoryInfo().GetFiles())
                {
                    string output = Path.Combine(dirOutput, file.Name);
                    file.CopyTo(output);
                }
            }
        }
    }
}